#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
# Author: nigo

## 列表与元组的转换

numbers_tuple = tuple([1, 2, 3, 4]) # 列表转元组
print(numbers_tuple)
numbers_list = list((1, 2, 3, 4)) # 元组转列表
print(numbers_list)

## 列表与字典的转换

numbers_dict = {'one': 1, 'two': 2, 'three': 3, 'four': 4}
print(list(numbers_dict.keys())) # 字典键转列表
print(list(numbers_dict.values())) # 字典值转列表

## 元组与字典转换

numbers_dict = {'one': 1, 'two': 2, 'three': 3, 'four': 4}
print(tuple(numbers_dict.keys())) # 字典键转元组
print(tuple(numbers_dict.values())) # 字典值转元组

numbers_tuple = (('one', 1), ('two', 2), ('three', 3), ('four', 4))
print(dict(numbers_tuple)) # 元组转字典
